<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>面试</title>
</head>
<style>
    div{
        background-color: red;
        width: 100px;
        height: 100px;
        margin: 0 auto;
        vertical-align: middle;
        position: absolute;
        top: 50%;
        left: 50%;
    }
</style>
<script>
    console.log(!!0==false);//true
    console.log(!!0==undefined);//false
    console.log(undefined==null);//true
    console.log(isNaN("1312")==NaN);//false
    console.log(typeof 1==true?1:0);//0
    console.log(typeof []=="array");//false
    console.log( [] instanceof Array);//true
    console.log(undefined==null);
    console.log(111&&222);
    console.log(false&&222);
    console.log(111||222);
    console.log(false||222);
    console.log(undefined==null);
    console.log(undefined===null);
    console.log(1==true);
    console.log(0==false);
    console.log(0=='');
    console.log(NaN==NaN);
    for(var i=0;i<3;i++){
        setTimeout(function(){
            console.log(i);
        },(function(){
            var b=i*1000;
            console.log(b);
            return b;
        })())
    }

    /**********************************************************/
   /* var a;
    console.log(typeof a);
    console.log(typeof b);
    var User={
        count:1,
        getCount:function(){
            return this.count;
        }
    }
    console.log(User.getCount());
    var func=User.getCount;
    console.log(func());*/
    /**********************************************************/
    var str='border-bottom-color';
   /* String.prototype.transform=function(){
        var arr=this.split('-');
        for(var i=1;i<arr.length;i++){
            arr[i]=arr[i].charAt(0).toUpperCase()+arr[i].substring(1);
        }
        return arr.join('');
    };
    console.log(str.transform());
    */
  /*  String.prototype.transform2=function(){
        var reg=/-(\w)/g;
        return this.replace(reg,function(){
            return arguments[1].toUpperCase();
        })
    }
    console.log(str.transform2());


    var str2='borderBottomColor';
    String.prototype.transform3=function(){
        var reg=/[A-Z]/g;
        return this.replace(reg,function(){
            return "-"+arguments[0].toLowerCase();
        });
    };
    console.log(str2.transform3());*/








    /**********************************************************/
   /* function request(){
        var url = "http://wqdian.com/item.html?a=1&b=2&c=&d=xxx&e";
        var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");
        console.log(paraString.length);
        var paraObj = {};
        for (i=0; j=paraString[i]; i++){
            if(j=paraString[paraString.length-1]){
                paraObj[j] = undefined;
            }else{
                paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);
            }
//                console.log(paraObj);

        }
        return paraObj;*/
       /* var returnValue = paraObj[paras.toLowerCase()];
        if(typeof(returnValue)=="undefined"){
            return "";
        }else{
            return returnValue;
        }
    }
  request();
        */
    //如你给出的地址可以这样
//    var classid = request("classid");
//    var id = request("id");

/***********************************************************/
  Array.prototype.unique1 = function(){
      var res = [this[0]];
      for(var i = 1; i < this.length; i++){
          var repeat = false;
          for(var j = 0; j < res.length; j++){
              if(this[i] == res[j]){
                  repeat = true;
                  break;
              }
          }
          if(!repeat){
              res.push(this[i]);
          }
      }
      return res;
  }
  var arr = [1, 'a', 'a', 'b', 'd', 'e', 'e', 1, 0];
//  alert(arr.unique1());
  /***********************************************************/
  Array.prototype.unique2 = function(){
      this.sort(); //先排序
      var res = [this[0]];
      for(var i = 1; i < this.length; i++){
          if(this[i] !== res[res.length - 1]){
              res.push(this[i]);
          }
      }
      return res;
  }
  var arr = [1, 'a', 'a', 'b', 'd', 'e', 'e', 1, 0];
//  alert(arr.unique2());
  /***********************************************************/

  Array.prototype.unique3 = function() {
       var res = [];
      var json = {};
      for(var i = 0; i < this.length; i++){
          if(!json[this[i]]){
              res.push(this[i]);
              json[this[i]] = "yes";
          }
      }
      return res;
   }

  var arr = [112,112,34,'你好',112,112,34,'你好','str','str1'];
//  alert(arr.unique3());
    var div=document.getElementsByTagName("div");
    console.log(div);
    div.onclick=(function(){
        console.log(this);
    }).bind(this);

    var num=100;
    var obj={
        num:200,
        inner:{
            num:300,
            print:function () {
                console.log(this.num);
            }
        }

    };
    obj.inner.print();
    var func=obj.inner.print;
    func();
    func.call(obj);
    setTimeout(obj.inner.print);
</script>
<body>
    <div>div</div>
</body>
</html>